package com.fenger.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

/**
 * @PackageName: com.fenger.servlet
 * @ClassName: UserServlet
 * @Description:
 * @author: fang
 * @date: 2021/10/31 10:18
 */
@WebServlet(name = "user", urlPatterns = "/user")
public class UserServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().write("<html>");
        resp.getWriter().write("<head>");
        resp.getWriter().write("</head>");
        resp.getWriter().write("<body><title>this is user page</title><h1>this is user page</h1>");
        resp.getWriter().write("<a href='./my'>toMy</a>");
        resp.getWriter().write("</body>");
        resp.getWriter().write("</html>");
        writer.close();
    }
}
